﻿Public Class FormVisualizarEmple

#Region "atributos publicos"
    Public _nombreBuscar As String
    Private _myBaseDatos As BBDDCita
#End Region

    Private Sub FormVisualizarEmple_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        _myBaseDatos = New BBDDCita
        RellenarDataGrid()

    End Sub

#Region "metodos privados"
    Private Sub RellenarDataGrid()
        Dim listaClientes As List(Of Cliente)
        listaClientes = _myBaseDatos.BusquedaClientes(_nombreBuscar)

        'recorremos el objecto
        For Each auxCliente As Cliente In listaClientes
            With auxCliente
                DataGridViewClientes.Rows.Add(.CodCliente, .Nombre, .Apellido)
            End With
        Next
    End Sub
#End Region


#Region "eventos"
    Private Sub DataGridViewClientes_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridViewClientes.CellDoubleClick
        If e.RowIndex > -1 And e.ColumnIndex > -1 Then
            Form_Cita.TextBoxombre.Text = DataGridViewClientes.Rows(e.RowIndex).Cells("nombre").Value
            Form_Cita.TextBoxombre.Text += " " & DataGridViewClientes.Rows(e.RowIndex).Cells("apellidos").Value
            Form_Cita._IdCliente = DataGridViewClientes.Rows(e.RowIndex).Cells("idCliente").Value
            Me.Close()
        End If
    End Sub
#End Region
    
End Class